package com.yfp.device.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yfp.device.domain.DeviceCurrentComboStock;
import com.yfp.device.domain.dto.OrderCreateDTO;
import com.yfp.device.domain.vo.ForeshowVo;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

/**
 * @author admin
 * @description 针对表【device_current_combo_stock】的数据库操作Service
 * @createDate 2024-06-20 11:04:22
 */
public interface DeviceCurrentComboStockService extends IService<DeviceCurrentComboStock> {

    /**
     * 根据设备id获取线上库存
     *
     * @param machineId
     * @return
     */
    List<DeviceCurrentComboStock> getByMachineId(String machineId);

    /**
     * 获取明日投放计划
     *
     * @param machineId
     * @param creatTime
     * @return
     */
    List<ForeshowVo> deviceComboForecast(String machineId, Timestamp creatTime);

    /**
     * 批量插入线上库存表
     *
     * @param dccsList
     */
    void insertAll(List<DeviceCurrentComboStock> dccsList);

    void batchUpdate(ArrayList<DeviceCurrentComboStock> dccsList);

    /**
     * 检测库存是否充足
     *
     * @param comboList
     * @param machineId
     * @return
     */
    Boolean checkStockAvailability(List<OrderCreateDTO.ShopCart> comboList, String machineId);

    /**
     * 减少库存
     *
     * @param comboList
     * @param machineId
     */
    void decreaseStockQuantity(List<OrderCreateDTO.ShopCart> comboList, String machineId);

    /**
     * 获取线上库存信息
     * @param machineId
     * @return
     */
    List<DeviceCurrentComboStock> getByMacineId(String machineId);
}
